//
//  ZCXCollectTableViewCell.m
//  LoveOfPet
//
//  Created by dllo on 15/11/20.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "ZCXCollectTableViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>

#define HEIGHT  [[UIScreen mainScreen]bounds].size.height / 667
#define WIDTH   [[UIScreen mainScreen]bounds].size.width / 375

@interface ZCXCollectTableViewCell ()
@property (nonatomic, retain) UIImageView *imageV;
@property (nonatomic, retain) UILabel *userLabel;
@property (nonatomic, retain) UILabel *feelLabel;
@end


@implementation ZCXCollectTableViewCell
- (void)dealloc{
    [_imageV release];
    [_userLabel release];
    [_feelLabel release];
    [super dealloc];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.userLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_userLabel];
        [_userLabel release];
        
        self.feelLabel = [[UILabel alloc]init];
        _feelLabel.textColor = [UIColor grayColor];
        _feelLabel.font = [UIFont systemFontOfSize:15 * WIDTH];
        _feelLabel.numberOfLines = 0;
        [self.contentView addSubview:_feelLabel];
        [_feelLabel release];
        
        self.imageV = [[UIImageView alloc]init];
        _imageV.layer.masksToBounds = YES;
        _imageV.layer.cornerRadius = 5 * WIDTH;
        
//        _imageV.layer.shadowColor = [UIColor redColor].CGColor;
//        _imageV.layer.shadowOpacity = 1;
//        _imageV.layer.shadowOffset = CGSizeMake(5, 5);
        
        [self.contentView addSubview:_imageV];
        [_imageV release];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _imageV.frame = CGRectMake(10 * WIDTH, 5 * HEIGHT, 60 * WIDTH, 60 * HEIGHT);
    _userLabel.frame = CGRectMake(75 * WIDTH, 5 * HEIGHT, 200 * WIDTH, 25 * HEIGHT);
    _feelLabel.frame = CGRectMake(75 * WIDTH, 35 * HEIGHT, self.frame.size.width - 80 * WIDTH, self.frame.size.height - 40 * HEIGHT);
    
}
- (void)setPetVideo:(ZPetVideo *)petVideo{
    if (_petVideo != petVideo) {
        [_petVideo release];
        _petVideo = [petVideo retain];
    }
    [_imageV sd_setImageWithURL:[NSURL URLWithString:petVideo.userImage]];
    _userLabel.text = petVideo.userName;
    _feelLabel.text = petVideo.userFeel;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
